home *** CD-ROM | disk | FTP | other *** search
- on keyDown
- if (the key = TAB) or (the key = RETURN) then
- if value(field "fHour") > 23 then
- beep()
- end if
- set the selEnd to length(field "fMinute")
- set the selStart to 0
- pass()
- end if
- if ((the keyCode >= 123) and (the keyCode <= 126)) or (the keyCode = 51) then
- pass()
- end if
- set myNum to value(the key)
- if voidp(myNum) then
- exit
- end if
- set myTempNum to field "fHour"
- set s to the selStart
- set e to the selEnd
- set the selEnd to s + 1
- set the selStart to s + 1
- if s <> e then
- set s to s + 1
- put the key into char s to e of myTempNum
- else
- if s = 0 then
- put the key before myTempNum
- else
- put the key after char s of myTempNum
- end if
- end if
- if (value(myTempNum) <= 23) and (length(myTempNum) <= 2) then
- put myTempNum into field "fHour"
- end if
- end
-